package objectinput_;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

public class objectinput_ {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        String pathname="d:\\next5.dat";
        ObjectInputStream ois=new ObjectInputStream(new FileInputStream(pathname));
        //要与序列化顺序一样，不然会出现读取信息不一致
        System.out.println(ois.readInt());
        System.out.println(ois.readFloat());
        System.out.println(ois.readDouble());
        System.out.println(ois.readBoolean());
        Object dog=ois.readObject();
        System.out.println("dog的类型"+dog.getClass());
        System.out.println("dog的信息"+dog);
        ois.close();
    }
}
